/**
 * SystemOutTask.java
 * com.sitech.dmcs.core.task
 * Function： TODO 
 *
 *   ver  author   date    
 * ──────────────────────────────────
 *   	 geutopia  Mar 14, 2011        
 *
 * Copyright (c) 2011, TNT All Rights Reserved.
*/

package com.sitech.timing.task;

import java.util.HashMap;
import java.util.Map;

import com.sitech.context.SpringContext;
import com.sitech.timing.domain.GroupTaskInstance;
import com.sitech.timing.domain.TaskInstance;
import com.sitech.timing.domain.TaskResult;
import com.sitech.timing.QueryService;
import com.sitech.timing.Task;

/**
 * ClassName:SystemOutTask
 * Function: TODO ADD FUNCTION
 * Reason:	 TODO ADD REASON
 *
 * @author   geutopia
 * @version  
 * @since    Ver 1.1
 * @Date	 2011	Mar 14, 2011		3:10:33 PM
 *
 * @see 	 
 */

public class SystemOutTask2 implements Task
{

	/**
	 * (non-Javadoc)
	 * @see com.sitech.timing.Task#runTask(java.util.Map, com.sitech.timing.domain.TaskInstance)
	 */
	public TaskResult runTask(Map<String, Object> paramMap, TaskInstance taskInstance)
	{
		QueryService queryService = (QueryService) SpringContext.getBean("queryService");
		GroupTaskInstance groupTaskInstance = queryService.getRunTaskGroup(taskInstance.getGroupTaskInstanceId());
		System.out.println("测试2："+paramMap.get("test"));

		System.out.println("GroupTaskId = " + taskInstance.getGroupTaskId() + "TaskId = " + taskInstance.getTaskId()
				+ "groupTaskInstanceId = " + taskInstance.getGroupTaskInstanceId() + "SupserGroupTaskId = "
				+ groupTaskInstance.getSuperGroupTaskInstanceId());
		
		if(paramMap != null)
		{
			for(Map.Entry<String, Object> entry : paramMap.entrySet())
			{
				System.out.println(entry.getKey() + " = " + entry.getValue());
			}
		}
		
		TaskResult taskResult = new TaskResult();
		
		Map<String, Object> valueMap = new HashMap<String, Object>();
		valueMap.put(taskInstance.getTaskId(), taskInstance.getGroupTaskId());
		taskResult.setResultMap(valueMap);
		return taskResult;
	}

}
